﻿using System;

namespace easy_ccms.core
{
    public class MailMessages : Mailer
    {

        //#region User management
        ///// <summary>
        ///// Sends notification to admin about user registering
        ///// </summary>
        ///// <param name="user"></param>
        //public static void NewUserRegistered(User user)
        //{
        //    string content = string.Format(NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Content, user.UserName, user.Email);
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Label);
        //    parser.ParseText("CONTENT", content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Footer);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Label,
        //        parser.GetTemplate(),
        //        NudaJeFuc.WebUI.Properties.Resources.adminEmail))
        //    {
        //        _log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        ///// <summary>
        ///// Send email activation to user
        ///// </summary>
        ///// <param name="activationKey"></param>
        ///// <param name="user"></param>
        ///// <param name="activationPage"></param>
        //public static void SendActivationLink(User user)
        //{
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_NewUserActivationRequest_Label);
        //    parser.ParseText("CONTENT", NudaJeFuc.WebUI.Properties.Resources.email_NewUserActivationRequest_Content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_NewUserActivationRequest_Footer);
        //    string linkToPage = NudaJeFuc.WebUI.Properties.Resources.WebsiteAddress + NudaJeFuc.WebUI.Properties.Settings.Default.ActivationPage;

        //    parser.ParseText("ACTIVATION-PAGE-LINK", linkToPage);
        //    parser.ParseText("ACTIVATION-KEY", user.NewPasswordKey.ToString());

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Label,
        //        parser.GetTemplate(),
        //        NudaJeFuc.WebUI.Properties.Resources.adminEmail))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        ///// <summary>
        ///// Activation has been successful email notification
        ///// </summary>
        ///// <param name="user"></param>
        //public static void UserActivationSucessfull(User user)
        //{
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_NewUser_RegistrationComplete_Label);
        //    parser.ParseText("CONTENT", NudaJeFuc.WebUI.Properties.Resources.email_NewUser_RegistrationComplete_Content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_NewUser_RegistrationComplete_Footer);
        //    string linkToPage = NudaJeFuc.WebUI.Properties.Resources.WebsiteAddress + NudaJeFuc.WebUI.Properties.Settings.Default.ActivationPage;

        //    parser.ParseText("LINK-TO-PAGE", NudaJeFuc.WebUI.Properties.Resources.WebsiteAddress);
        //    parser.ParseText("USER-NAME", user.UserName.ToString());

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Label,
        //        parser.GetTemplate(),
        //        NudaJeFuc.WebUI.Properties.Resources.adminEmail))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        ///// <summary>
        ///// Users password reset email
        ///// </summary>
        ///// <param name="email">Email address to whom send the email</param>
        ///// <param name="newPassword">New password to recover user account</param>        
        //public static void PasswordReset(string email, string newPassword)
        //{
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_UserPasswordReset_label);
        //    parser.ParseText("CONTENT", NudaJeFuc.WebUI.Properties.Resources.email_UserPasswordReset_body);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_UserPasswordReset_footer);
        //    string linkToPage = NudaJeFuc.WebUI.Properties.Resources.WebsiteAddress + NudaJeFuc.WebUI.Properties.Settings.Default.ActivationPage;

        //    parser.ParseText("LINK-TO-PAGE", NudaJeFuc.WebUI.Properties.Resources.WebsiteAddress);
        //    parser.ParseText("PASSWORD", newPassword);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_UserPasswordReset_label,
        //        parser.GetTemplate(),
        //        NudaJeFuc.WebUI.Properties.Resources.adminEmail))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        //#endregion
        //#region event related
        ///// <summary>
        ///// User registering for event email to event owner
        ///// </summary>
        ///// <param name="userRegistering">User which is registering</param>
        ///// <param name="userOwner">Event owner</param>
        ///// <param name="eventToJoin">Event to which they are joining</param>        
        //public static void UserRegisteredForEvent(MembershipUser userRegistering, MembershipUser userOwner, Event eventToJoin)
        //{
        //    string content = string.Format(NudaJeFuc.WebUI.Properties.Resources.email_UserRegisteredForEvent_Content, userRegistering.UserName);
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_UserRegisteredForEvent_Label);
        //    parser.ParseText("CONTENT", content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_UserRegisteredForEvent_Footer);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_NewUserRegisteredAdminNotification_Label,
        //        parser.GetTemplate(),
        //        userOwner.Email))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        ///// <summary>
        ///// User unregistered from event email
        ///// </summary>
        ///// <param name="userRegistering">User which is registering</param>
        ///// <param name="userOwner">Event owner</param>
        ///// <param name="eventToJoin">Event to which they are joining</param>
        //public static void UserUnregisteredForEvent(string userName, string userOwnerEmail, Event eventToJoin)
        //{
        //    string content = string.Format(NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Content, userName);
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Label);
        //    parser.ParseText("CONTENT", content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Footer);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Label,
        //        parser.GetTemplate(),
        //        userOwnerEmail))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        ///// <summary>
        ///// Notification to the users registered to the event about cancelling the event
        ///// </summary>
        ///// <param name="eventCanceled">Event registered for</param>
        ///// <param name="User">user to whom message will be send</param>
        //public static void EventCanceled(Event eventCanceled, string Email)
        //{
        //    string content = string.Format(NudaJeFuc.WebUI.Properties.Resources.email_NewUser_RegistrationComplete_Content, eventCanceled.Name);
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Label);
        //    parser.ParseText("CONTENT", content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Footer);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Label,
        //        parser.GetTemplate(),
        //        Email))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}

        ///// <summary>
        ///// Notification to user about Event has been modified 
        ///// </summary>
        ///// <param name="eventCanceled">Event registered for</param>
        ///// <param name="User">user to whom message will be send</param>
        //public static void EventModified(Event eventModified, string Email)
        //{
        //    string content = string.Format(NudaJeFuc.WebUI.Properties.Resources.email_EventModified_Content, eventModified.Name);
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_EventModified_Label);
        //    parser.ParseText("CONTENT", content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_EventModified_Foot);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Label,
        //        parser.GetTemplate(),
        //        Email))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        ///// <summary>
        ///// Notification to user about Event has been modified 
        ///// </summary>
        ///// <param name="eventCanceled">Event registered for</param>
        ///// <param name="User">user to whom message will be send</param>
        //public static void EventDeletedByAdmin(Event eventModified, string Email, string reasonForDeleting)
        //{
        //    string content = string.Format(reasonForDeleting, eventModified.Name);
        //    MailTemplateParser parser = new MailTemplateParser();
        //    parser.LoadTemplate("~/Content/EmailTemplate/email.htm");
        //    parser.ParseText("LABEL", NudaJeFuc.WebUI.Properties.Resources.email_AdministratorChangedRemovedEvent);
        //    parser.ParseText("CONTENT", content);
        //    parser.ParseText("FOOTER", NudaJeFuc.WebUI.Properties.Resources.email_EventModified_Foot);

        //    if (!Mailer.SendMail(
        //        NudaJeFuc.WebUI.Properties.Resources.email_EventCanceled_Label,
        //        parser.GetTemplate(),
        //        Email))
        //    {
        //        Log.LogErrorMessage("Failed to send email to administrator" + DateTime.Now.ToString() + "\r\n with message" + parser.ToString(), "MailMessages");
        //    }
        //}
        //#endregion
    }
}